package com.dragon.repository.domain.vo;

import com.dragon.common.model.Update;
import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.AdminPosition;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author sy
 */
@Data
@ApiModel(value = "")
public class AdminPositionVO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    private Integer id;

    @ApiModelProperty(value = "用户id")
    private Integer adminId;

    @ApiModelProperty(


value = "岗位id")
    private Integer positionId;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;    @NotNull(groups = Update.class,message = "主键不能为空")
    public static AdminPosition convert(AdminPositionVO vo) {
        AdminPosition entity = new AdminPosition();
        BeanUtils.copyProperties(vo,entity);
        return entity;
    }
    public static List<AdminPosition> convertList(List<AdminPositionVO> list) {
        List<AdminPosition> resultList = new ArrayList<>();
        for (AdminPositionVO vo : list) {
            resultList.add(convert(vo));
        }
        return resultList;
    }
}
